package com.keba.lamp.model.enumeration.complaint;

import com.keba.lamp.model.enumeration.base.FileType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "AI文件类型-枚举")
public enum AiFileType {

    IMAGE(FileType.IMAGE, "image_url"),
    AUDIO(FileType.AUDIO, "audio_url"),
    ;

    private FileType fileType;
    private String aiType;

    public FileType getFileType() {
        return fileType;
    }

    public String getAiType() {
        return aiType;
    }

    public static String matchAiType(FileType fileType) {
        AiFileType aiFileType = Stream.of(values()).parallel().filter(item ->
                item.getFileType().eq(fileType)
        ).findFirst().orElse(null);
        return Objects.isNull(aiFileType) ? null : aiFileType.getAiType();
    }
}
